/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package BeanManager;

import java.util.List;
import mapper.ClinsdoeilMapper;
import mapper.MessageMapper;

import org.apache.ibatis.session.SqlSession;
import packageEntities.Clinsdoeil;
import packageEntities.Messages;

import service.ConnexionBd;
import static service.ConnexionBd.session;

/**
 *
 * @author nmeli
 */
public class ClinsdoeilManager {
   public static List<Clinsdoeil> affiche() {
      SqlSession unesession= ConnexionBd.getConnexion();
ClinsdoeilMapper clins = session.getMapper(ClinsdoeilMapper.class);           
            List<Clinsdoeil> mesClins = clins.getAll();
                 ConnexionBd.closeConnexion();
    return mesClins;
}
      public static boolean ajout(Clinsdoeil mess) {
        int nbMod = 0;
        SqlSession session = ConnexionBd.getConnexion();
        ClinsdoeilMapper clins = session.getMapper(ClinsdoeilMapper.class);
        nbMod = clins.Ajoutclins(mess);

        session.commit();

        ConnexionBd.closeConnexion();
        return (nbMod > 0 ? true : false);
   
      }
       public static  List<Clinsdoeil> afficheParMembre(int id) {
      SqlSession unesession= ConnexionBd.getConnexion();
            ClinsdoeilMapper clins = session.getMapper(ClinsdoeilMapper.class);           
            List<Clinsdoeil> mesClins = clins.getfrom(id);
            ConnexionBd.closeConnexion();
            return mesClins;
} 
}
